package dsx.starter;

import java.io.File;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;

public class Starter {

	public static void main(String[] args) throws Exception {
		String framePath = Config.get("frameLib", "path");
		load(framePath + "DsxFrame.jar");
		load(framePath + "DsxMacro.jar");
		Class<?> frameStartClass = Class.forName("dsx.dsxFrame.DsxFrame");
		Method method = frameStartClass.getMethod("init", new Class[] {});
		method.invoke(new Object[] { null, null });
		while (true) {
			try {
				Thread.sleep(1000);
			} catch (Exception ex) {

			}
		}
	}

	private static void load(String path) throws Exception {
		URL url = new File(path).toURI().toURL();
		// 加载本目录
		Class<URLClassLoader> sysclass = URLClassLoader.class;
		Method method = sysclass.getDeclaredMethod("addURL",
				new Class[] { URL.class });
		method.setAccessible(true);
		method.invoke(ClassLoader.getSystemClassLoader(), url);
	}

}
